<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../../../../assets/libs/jquery/jquery-3.6.1.min.js"></script>
  <style>
    * {
      padding: 0;
      margin: 0;
    }

    div {
      width: 100px;
      height: 100px;
      padding: 100px;
      border: 100px solid black;
      margin: 100px;
    }
  </style>
</head>

<body>
  <div></div>

  <script>
    // 获取 width height
    console.log(
      $('div').width(),
      $('div').height()
    )

    // 设置 width height
    /* $('div').width(200)
    $('div').height(200) */

    // 获取 width height + padding
    console.log(
      $('div').innerWidth(),
      $('div').innerHeight()
    )

    // 获取 width height + padding + border
    console.log(
      $('div').outerWidth(),
      $('div').outerHeight()
    )

    // 获取 width height + padding + border + margin
    console.log(
      $('div').outerWidth(true),
      $('div').outerHeight(true)
    )
  </script>
</body>

</html>